/**
 * 
 */
package net.dfrz.java1305.team4.utils;

import java.util.Collection;

/**
 * @author acer
 *
 */
public class Page {

	private Integer pageNo;     
	private Integer pageSize;   
	private boolean nextPage;   
	private boolean prePage;   
	private Long totalRecCnt;  
	private int totalPageCnt;  
	private Collection pageContent; 
	private Integer startIndex; 
	private Integer endIndex;   
	
	public Page() {
		super();
		this.pageNo=1;
		this.pageSize=14;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public boolean isNextPage() {
		return this.pageNo<this.getTotalPageCnt()?true:false;
	}

	public boolean isPrePage() {
		return this.pageNo>1?true:false;
	}

	public void setPrePage(boolean prePage) {
		this.prePage = prePage;
	}

	public Long getTotalRecCnt() {
		return totalRecCnt;
	}

	public void setTotalRecCnt(Long totalRecCnt) {
		this.totalRecCnt = totalRecCnt;
	}

	public int getTotalPageCnt() {
		return this.totalRecCnt%this.pageSize == 0?(int)(this.totalRecCnt/this.pageSize):(int)(this.totalRecCnt/this.pageSize+1);
	}

	public Collection getPageContent() {
		return this.pageContent;
	}

	public void setPageContent(Collection pageContent) {
		this.pageContent = pageContent;
	}

	public Integer getStartIndex() {
		return this.pageSize*(this.pageNo-1)+1;
	}

	public Integer getEndIndex() {
		return this.pageSize*this.pageNo>this.totalRecCnt?(int)(this.totalRecCnt.longValue()):this.pageSize*this.pageNo;
	}
	
}
